import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sainbainu/common/services/user.dart';
import 'package:sainbainu/common/routes/routes.dart';

/// 鉴权中间件
class AuthMiddleware extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    if (!UserService.to.isLogin.value) {
      return const RouteSettings(name: AppRoutes.login);
    }
    return null;
  }
}
